﻿// This code is released under the BSD license.
namespace PugLib
{
    using System;
    using System.Globalization;

    public class Index : ValidatedObject<int>
    {
        public Index(int value, int max)
            : base(value, validIndex(max))
        {
        }

        private static Func<int, bool> validIndex(int max)
        {
            return x => x > -1 && x < max;
        }

        public override string ToString()
        {
			return Value.ToString(CultureInfo.CurrentCulture);
        }
    }
}